package net.jonbuck.tassoo.eventmanager.events;

import net.jonbuck.tassoo.eventmanager.exception.UnsupportedListenerException;
import net.jonbuck.tassoo.eventmanager.listener.ContainerCreationEventListener;
import net.jonbuck.tassoo.eventmanager.listener.TaskEventListener;
import net.jonbuck.tassoo.model.Container;

/**
 * 
 * 
 * @since 1.0.0
 */
public class ContainerCreationEvent implements TassooEvent {

	private Container container;
	
	/**
	 * 
	 * @param container
	 */
	public ContainerCreationEvent(Container container) {
		super();
		this.container = container;
	}

	/**
	 * 
	 */
	public void dispatchEvent(Object listener) {
		if (listener instanceof TaskEventListener) {
			final ContainerCreationEventListener eventListener = (ContainerCreationEventListener) listener;
			eventListener.processContainerCreationEvent(container);
		} else {
			throw new UnsupportedListenerException("001", "Blah");
		}

	}

}
